<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\video\behavior\cancel_comment_reply_before;

/**
 * 校验删除回复人的身份
 * @package app\user_center\behavior\user
 * @author jason wang
 */
class checkReply{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
    	$uid 	 	= $params['user_id'];
    	$reply_id 	= $params['reply_id'];
		
		$reply_info 	= model('VideoPlayCommentReplay') -> find($reply_id);//回复获取
		if(empty($reply_info)){
			return array_out(-1001, '没有找到本条回复');
		}
		
		$reply_uid 		= $reply_info -> uid;
		$play_id		= $reply_info -> play_id;
		
		$play_uid 	= model('VideoPlay') -> find($play_id) -> uid;//视频获取
		
		//不是作者 并且 不是视频作者
		if($uid != $reply_uid && $uid != $play_uid){
			return array_out(-1001, '没有权限该评论删除');
		}
    }
}
